<template>
  <el-dialog :title="title" :visible.sync="visible" :append-to-body="appendToBody" :fullscreen="fullscreen" :before-close="onClose">
    <iframe ref="iframe_ref" :src="src" :style="'border: none; overflow: auto; width: 100%; height: ' + height + 'px;'" />
  </el-dialog>
</template>

<script>
export default {
  name: 'SpiderFormDialog',
  props: {
    title: {
      type: String,
      default: ''
    },
    fullscreen: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      visible: false,
      appendToBody: false,
      src: '',
      height: document.documentElement.clientHeight - 140 + 'px;'
    }
  },
  created() {
    this.src = ''
  },
  methods: {
    init(url) {
      this.visible = true
      this.$nextTick(() => {
        this.src = url
      })
    },
    onClose() {
      this.$emit('confirmForm')
      this.src = ''
      this.visible = false
    }
  }
}
</script>
